package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
)

func main() {
	router := gin.Default()
	router.GET("/", func(c *gin.Context) {
		//获取一个请求头
		header := c.GetHeader("User-Agent")
		//Header是一个map
		fmt.Println(c.Request.Header)
		//设置响应头
		c.Header("tocken", "12314")
		c.JSON(200, gin.H{"header": header})
	})
	router.Run(":8080")
}
